﻿using GearOptimizer.DataObjects;
using RestSharp;

namespace GearOptimizer.Adapters
{
    public class BattleNetAdapter : IBattleNetAdapter
    {
        public Character RetrieveCharacterProfile(string characterName, string realmName)
        {
            var battleNetClient = new RestClient("http://us.battle.net");

            var battleNetRequest = new RestRequest(string.Format("/api/wow/character/{0}/{1}?fields=items", realmName, characterName));

            var battleNetResponse = battleNetClient.Execute<Character>(battleNetRequest);

            return battleNetResponse.Data;
        }

        public Item RetrieveItem(string itemId)
        {
            var battleNetClient = new RestClient("http://us.battle.net");

            var battleNetRequest = new RestRequest(string.Format("/api/wow/item/{0}", itemId));

            var battleNetResponse = battleNetClient.Execute<Item>(battleNetRequest);

            return battleNetResponse.Data;
        }
    }
}